/*
 * Copyright 2019 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.mantisrx.server.master.scheduler;


import io.mantisrx.common.WorkerPorts;


public class LaunchTaskRequest {

    private final ScheduleRequest scheduleRequest;
    private final WorkerPorts ports;

    public LaunchTaskRequest(ScheduleRequest scheduleRequest, WorkerPorts ports) {
        this.scheduleRequest = scheduleRequest;
        this.ports = ports;
    }

    public ScheduleRequest getScheduleRequest() {
        return scheduleRequest;
    }

    public WorkerPorts getPorts() {
        return ports;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LaunchTaskRequest that = (LaunchTaskRequest) o;

        if (scheduleRequest != null ? !scheduleRequest.equals(that.scheduleRequest) : that.scheduleRequest != null)
            return false;
        return ports != null ? ports.equals(that.ports) : that.ports == null;
    }

    @Override
    public int hashCode() {
        int result = scheduleRequest != null ? scheduleRequest.hashCode() : 0;
        result = 31 * result + (ports != null ? ports.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "LaunchTaskRequest{" +
                "scheduleRequest=" + scheduleRequest +
                ", ports=" + ports +
                '}';
    }
}
